/*

#define _CRT_SECURE_NO_WARNINGS
#pragma warning(disable:4996)


#include <iostream>
#include <string>
#include <cstring>
#include <WinSock2.h>

#pragma comment(lib,"ws2_32.lib")

using namespace std;
uint16_t serverport = 8080; // 服务器开通的端口号(./server 8080)
string serverip = "43.143.88.137"; // 服务器的公网IP

int main()
{
    WSAData wsd;
    if (WSAStartup(MAKEWORD(2, 2), &wsd) != 0)
    {
        cout << "WSAStartup Error = " << WSAGetLastError() << endl;
        return 0;
    }
    else
    {
        cout << "WSAStartup Success" << endl;
    }

    SOCKET csock = socket(AF_INET, SOCK_DGRAM, 0);
    if (csock == SOCKET_ERROR)
    {
        cout << "socket Error = " << WSAGetLastError() << endl;
        return 1;
    }
    else
    {
        cout << "socket success" << endl;
    }
    struct sockaddr_in server;
    memset(&server, 0, sizeof(server));
    server.sin_family = AF_INET;
    server.sin_port = htons(serverport);
    server.sin_addr.s_addr = inet_addr(serverip.c_str());
#define NUM 1024
    char inbuffer[NUM];
    string line;
    while (true)
    {
        cout << "Please Enter#";
        getline(cin, line);

        int n = sendto(csock, line.c_str(), line.size(), 0, (struct sockaddr*)&server, sizeof(server));
        if (n < 0)
        {
            cerr << "sendto error!" << endl;
            break;
        }
        struct sockaddr_in peer;
        int peerlen = sizeof(peer);
        inbuffer[0] = 0;
        n = recvfrom(csock, inbuffer, sizeof(inbuffer) - 1, 0, (struct sockaddr*)&peer, &peerlen);
        if (n > 0)
        {
            inbuffer[n] = 0;
            cout << "server 返回的消息是#" << inbuffer << endl;
        }
        else break;
    }
    closesocket(csock);
    WSACleanup();
    return 0;
}

*/